package com.qf.pojo;

import java.awt.image.BufferedImage;
import java.time.LocalDateTime;

// 图片验证码的类
public class ImageCode {
    private String code;
    private BufferedImage image;
    private LocalDateTime expire;

    /**
     * @param code
     * @param image
     * @param num  图片验证码的过期时间
     */
    public ImageCode(String code, BufferedImage image, int num) {
        this.code = code;
        this.image = image;
        this.expire = LocalDateTime.now().plusSeconds(num);
    }

    // 是否过期expire.is
    public boolean isExpired()  {
        return this.expire.isBefore(LocalDateTime.now());
    }

    public ImageCode() {
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public BufferedImage getImage() {
        return image;
    }

    public void setImage(BufferedImage image) {
        this.image = image;
    }

    public LocalDateTime getExpire() {
        return expire;
    }

    public void setExpire(LocalDateTime expire) {
        this.expire = expire;
    }
}
